package 字符流;

import java.io.*;

/*
* BufferedWriter: void newLine()  写一行行分隔符，行分隔符字符串由系统属性定义
* BufferedReader: String readLine() 读一行文字，结果保函行的内容的字符串，不包括任何终止字符，如果流的结尾已经到达。则为null
* */
public class 字符缓冲流特有功能 {
    public static void main(String[] args) throws IOException {
        BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\111\\222.txt"));
        /*写数据*/
        for (int i = 0; i < 10; i++) {
            bw.write("hello"+i);
            bw.newLine();
            bw.flush();
        }
        /*释放资源*/
        bw.close();

        /*创建字符缓冲输入流 读数据*/
        BufferedReader br = new BufferedReader(new FileReader("D:\\111\\222.txt"));
        String line;
        while ((line=br.readLine())!=null){
            System.out.println(line);
        }
        br.close();
    }
}